package com.ruoyi.project.anfang.controller;


import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.anfang.domain.*;
import com.ruoyi.project.anfang.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Api(tags = "H5端")
@RestController
@RequestMapping("/mini/anfang")
public class MiniController extends BaseController {


    @Autowired
    private IBannerService bannerService;


    @Autowired
    private IFangZhenService fangZhenService;
    @Autowired
    private IGongGaoService gongGaoService;


    @Autowired
    private IGongNengService gongNengService;



    @Autowired
    private IGongZhongService gongZhongService;


    @Autowired
    private IZiXunService ziXunService;


    @Autowired
    private ICommonAllService commonAllService;

    /**
     * 查询通用管理列表
     */
//    @PreAuthorize("@ss.hasPermi('anfang:commonall:list')")
    @GetMapping("/listCommonAll")
    @ApiOperation("通用管理--列表")
    public TableDataInfo listCommonAll(CommonAll commonAll)
    {
        startPage();
        List<CommonAll> list = commonAllService.selectCommonAllList(commonAll);
        return getDataTable(list);
    }
    /**
     * 获取通用管理详细信息
     */
//    @PreAuthorize("@ss.hasPermi('anfang:commonall:query')")
    @GetMapping(value = "/commonAll/{id}")
    @ApiOperation("通用管理--详情")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(commonAllService.selectCommonAllById(id));
    }

    /**
     * 查询资讯管理列表
     */
//    @PreAuthorize("@ss.hasPermi('anfang:zixun:list')")
    @GetMapping("/ziXunList")
    @ApiOperation("资讯管理--列表")
    public TableDataInfo list(ZiXun ziXun)
    {
        startPage();
        List<ZiXun> list = ziXunService.selectZiXunList(ziXun);
        return getDataTable(list);
    }

    /**
     * 获取资讯管理详细信息
     */
//    @PreAuthorize("@ss.hasPermi('anfang:zixun:query')")
    @GetMapping(value = "/ziXun/{id}")
    @ApiOperation("资讯管理--详情")
    public AjaxResult getInfoZiXun(@PathVariable("id") String id)
    {
        return success(ziXunService.selectZiXunById(id));
    }



    /**
     * 查询公众号管理列表
     */
    @GetMapping("/gongZhongList")
    @ApiOperation("公众号管理--列表")
    public TableDataInfo gongZhongList(GongZhong gongZhong)
    {
        startPage();
        List<GongZhong> list = gongZhongService.selectGongZhongList(gongZhong);
        return getDataTable(list);
    }

    /**
     * 获取公众号管理详细信息
     */
    @GetMapping(value = "/gongZhong/{id}")
    @ApiOperation("公众号管理--详情")
    public AjaxResult getInfoGongZhong(@PathVariable("id") String id)
    {
        return success(gongZhongService.selectGongZhongById(id));
    }
    /**
     * 查询功能点位管理列表
     */
    @GetMapping("/gongNenglist")
    @ApiOperation("功能点位--列表")
    public TableDataInfo gongNenglist(GongNeng gongNeng) {
        startPage();
        List<GongNeng> list = gongNengService.selectGongNengList(gongNeng);
        return getDataTable(list);
    }


    /**
     * 获取功能点位管理详细信息
     */
    @GetMapping(value = "/gongneng/{id}")
    @ApiOperation("功能点位--详情")
    public AjaxResult getGongNengInfo(@PathVariable("id") String id) {
        return success(gongNengService.selectGongNengById(id));
    }


    /**
     * 查询公告管理列表
     */
    @GetMapping("/gonggaoList")
    @ApiOperation("公告管理--列表")
    public TableDataInfo gonggaoList(GongGao gongGao) {
        startPage();
        List<GongGao> list = gongGaoService.selectGongGaoList(gongGao);
        return getDataTable(list);
    }

    /**
     * 获取公告管理详细信息
     */
//    @PreAuthorize("@ss.hasPermi('anfang:gonggao:query')")
    @GetMapping(value = "/gonggao/{id}")
    @ApiOperation("公告管理--详情")
    public AjaxResult getGonggaoInfo(@PathVariable("id") String id) {
        return success(gongGaoService.selectGongGaoById(id));
    }

    /**
     * 查询banner管理列表
     */
    @GetMapping("/bannerList")
    @ApiOperation("banner--列表")
    public TableDataInfo bannerList(Banner banner) {
        startPage();
        List<Banner> list = bannerService.selectBannerList(banner);
        return getDataTable(list);
    }

    /**
     * 获取banner管理详细信息
     */
    @GetMapping(value = "/banner/{id}")
    @ApiOperation("banner--详情")
    public AjaxResult getBannerInfo(@PathVariable("id") String id) {
        return success(bannerService.selectBannerById(id));
    }

    /**
     * 查询方针管理列表
     */
    @GetMapping("/fangzhenList")
    @ApiOperation("方针管理--列表")
    public TableDataInfo fangzhenList(FangZhen fangZhen) {
        startPage();
        List<FangZhen> list = fangZhenService.selectFangZhenList(fangZhen);
        return getDataTable(list);
    }

    /**
     * 获取方针管理详细信息
     */
    @GetMapping(value = "/fangzhen/{id}")
    @ApiOperation("方针管理--详情")
    public AjaxResult getFangzhenInfo(@PathVariable("id") String id) {
        return success(fangZhenService.selectFangZhenById(id));
    }


}
